package com.sz.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sz.dao.IRevExpDao;
import com.sz.pojo.RevExp;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.sql.Wrapper;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;

@Service
public class RevExpSVImpl implements IRevExpSV{
    //1页的大小
    final private int DateForOnePage = 14;

    @Resource
    private IRevExpDao iRevExpDao;

    @Override
    public int addRecord(RevExp revExp) {
        //revExp应传入adder, money, type, date, `describe`, remarks
        return iRevExpDao.addRecord(revExp);
    }

    @Override
    public List<RevExp> queryAll2(int page) {
        return iRevExpDao.queryAll2(page * DateForOnePage);
    }

    @Override
    public List<RevExp> queryAll0(int page) {
        return iRevExpDao.queryAll0(page * DateForOnePage);
    }

    @Override
    public List<RevExp> querySome0(String queryContent,int page) {
        queryContent = "%"+queryContent+"%";
        return iRevExpDao.querySome0(queryContent,page * DateForOnePage);
    }

    @Override
    public List<RevExp> querySome2(String queryContent,int page) {
        queryContent = "%"+queryContent+"%";
        return iRevExpDao.querySome2(queryContent,page * DateForOnePage);
    }

    @Override
    public int deleteById(int id) {
        return iRevExpDao.deleteById(id);
    }

    @Override
    public RevExp queryById(int id) {
        return iRevExpDao.queryById(id);
    }

    @Override
    public int updateById1(RevExp revExp) {
        return iRevExpDao.updateById(revExp);
    }

    @Override
    public List<RevExp> getAllAdder() {
        return iRevExpDao.getAllAdder();
    }

    @Override
    public List<RevExp> getByChoose(String sql) {
        return iRevExpDao.getByChoose(sql);
    }
}
